<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@page import="java.util.*"%>
<%@page import="dyyx.*"%>
<%@page import="dyyx.util.*"%>



<style>
  td{
      vertical-align: top;
  }
  
  <!--
    .btn{
      width:90px;
      height:50px;
      font-size:50px; 
  }
  -->
</style>


<b> H2 web client </b>

<br>

<table style='width:99%;height:99%' border=0>


<form name=form1 method="post" target='result' action='query.jsp'>

 <tr height='120px'>
     <td width='70%'> 
     
    
     
     
     maxRows <input type='text' name='maxRows' value='500' style='width:50px'>
     <span style='display:none'>
     <input type='checkbox' name='newwin' value='1'> newwin
     </span>
     <input type='hidden' name='sql'>
     <br>
     
     <textarea name='sql0' cols='120' rows='9'> </textarea>

     </td>
     <td>  
      <input class='btn' type="button" value='conntest' onclick='conntest()'>  <br> <br>
     <!--  
     <input class='btn' type="button" value='sqlhis' onclick='sqlhis()'>  <br> <br>
          -->
           <input class='btn' type="button" value='query' onclick='query()'> <br> <br>
           
           <input class='btn' type="button" value='update' onclick='update()'> <br> <br>
           
     </td>
 </tr>
 
 </form>
 
   <tr>
     <td colspan=2>  
    
    <iframe name='result' width='99%' height='99%' border=0></iframe>

     </td>
   
 </tr>

</table> 

<script>
function setSql(sqlstr){
	form1.sql0.value=sqlstr;
}

<!--
function sqlhis(){
	 presubmit();
	 form1.action='sqlhis.jsp';
	 form1.submit();
}
-->

function conntest(){
	 presubmit();
	 form1.action='conntest.jsp';
	 form1.submit();
}

 function query(){
	 presubmit();
	 form1.action='query.jsp';
	 form1.submit();
 }
 
 
 function update(){
	 
	 
	 presubmit();
	 
	 var msg = "确认要执行更新操作?sql="+form1.sql.value;
	 if(!confirm(msg)){
		 return;
	 }
	 
	 form1.action='update.jsp';
	 form1.submit();
 }
 
 function getSql(){
	 
	 var obj = form1.sql0;
	 var str = obj.value;
	//alert("sstart="+obj.selectionStart +",send="+obj.selectionEnd);
	//	    if(obj.selectionStart){  
	//	        return str.substring(obj.selectionStart,obj.selectionEnd);      
	//	    }
		return   str;
 }
 function presubmit(){	 
	 var tmp = getSql();	
	 form1.sql.value = tmp;	 
	 //alert(form1.sql.value);
	 
	 var flag = form1.newwin.checked;
	
	 if(flag){
		 form1.target='_blank';
	 }else{
		 form1.target='result';
	 }
	 //alert('flag='+flag+",target="+form1.target);
 }
</script>
